package com.nulldev.util.networking.npacket4.iprotocols.ncryptx.methods.newhope;

public class NewHopeKeyPair {
	private NewHopePublicKey pubKey;
	private final NewHopePrivateKey privKey;

	public NewHopeKeyPair(NewHopePrivateKey prKey, RingElt a) {
		privKey = prKey;
		privKey.toFourierDomain();
		pubKey = new NewHopePublicKey(prKey, a);
	}

	public NewHopeKeyPair(NewHopePrivateKey prKey, RingElt e, RingElt a) {
		privKey = prKey;
		privKey.toFourierDomain();
		pubKey = new NewHopePublicKey(prKey, e, a);
	}

	public NewHopeKeyPair(byte[] inKey, RingElt a) {
		privKey = new NewHopePrivateKey(inKey);
		privKey.toFourierDomain();
		pubKey = new NewHopePublicKey(privKey, a);
	}

	public NewHopeKeyPair(byte[] inKey, RingElt e, RingElt a) {
		privKey = new NewHopePrivateKey(inKey);
		privKey.toFourierDomain();
		pubKey = new NewHopePublicKey(privKey, e, a);
	}

	public NewHopeKeyPair(RingElt a) {
		privKey = new NewHopePrivateKey();
		privKey.toFourierDomain();
		pubKey = new NewHopePublicKey(privKey, a);
	}

	public NewHopePrivateKey getPrivateKey() {
		return privKey;
	}

	public NewHopePublicKey getPublicKey() {
		return pubKey;
	}

	// Generate a new public key with the same private key but new error term
	public void genNewPubKey(RingElt a) {
		pubKey = new NewHopePublicKey(privKey, a);
	}
}